Skip to content

Kddimitrov/fix worker loader cachable #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 18, 2019

Conversation

KristianDD
Copy link
Contributor

@KristianDD KristianDD commented Nov 15, 2019

The worker loader was marked as non cachable - here, which caused a new child compilation and new emit on every change - source here.

When the cache disable is removed initially(after first compilation) the worker files are added as a dependency and watched, because the file dependencies of the child compilation are added to the fileDependencies of the parent compilation - here.

After the first change webpack doesn't find any module dependent on the files and the loader result is cached, so no child compilation is started. This results in that the watcher no longer is even watching the files - source here.

To fix this, we should take all file dependencies of the child compilation and add them to the file dependencies of the module. Now this method will mark the module as one that needs rebuild which will in turn invoke the loader logic.

Fixes #41

@cla-bot cla-bot bot added the cla: yes label Nov 15, 2019
const plugin = { name: "WorkerLoader" };

workerCompiler.hooks.compilation.tap(plugin, compilation => {
if (compilation.cache) {
Copy link
Contributor Author

@KristianDD KristianDD Nov 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed based on this issue - jantimon/html-webpack-plugin#1089

@KristianDD KristianDD merged commit b7f5db9 into master Nov 18, 2019
@KristianDD KristianDD deleted the kddimitrov/fix-worker-loader-cachable branch November 18, 2019 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HMR doesn't work in projects that use Plugins that use workers
2 participants